package com.wgtp.ssapp.model.fragments;

import java.util.ArrayList;

import com.wgtp.ssapp.R;
import com.wgtp.ssapp.model.SubForum;
import com.wgtp.ssapp.model.adapters.ForumListAdapter;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.ListView;
import android.widget.TextView;

public class MainPageFragment extends Fragment {
	
	private ArrayList<SubForum> subForumList;

    public MainPageFragment(ArrayList<SubForum> subForumList) {
    	this.subForumList = subForumList;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        ListView forumListView = new ListView(getActivity());
        ForumListAdapter forumListAdapter = new ForumListAdapter(getActivity(), R.layout.forum_list_item_row, subForumList);
        forumListView.setAdapter(forumListAdapter);

        LinearLayout layout = new LinearLayout(getActivity());
        layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
        layout.setGravity(Gravity.CENTER);
        layout.addView(forumListView);

        return layout;
    }
	
}
